/**
 *
 * © Bahadir Zeren 2011
 * bzeren@gmail.com
 * No warranties, express or implied, are made for this program.
 *
 */

package org.baatar.opt.genetic.comparator;

import java.io.Serializable;
import java.util.Comparator;
import org.baatar.opt.genetic.chromosome.IChromosome;

/**
 *
 * @author Ba
 */
public class MinimizationComparator<T> implements Comparator<IChromosome<T>>, Serializable {

    @Override
    public int compare(IChromosome<T> o1, IChromosome<T> o2) {
        if (o1.getFitness() < o2.getFitness())
            return 1;
        else
            if (o1.getFitness() > o2.getFitness())
                return -1;
            else
                return 0;
    }
    
}
